package sample;

import javafx.application.Application;
import javafx.concurrent.Worker;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{
//        Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
        primaryStage.setTitle("Hello World");
//        primaryStage.setScene(new Scene(root, 300, 275));
//        primaryStage.show();
        //设置窗体布局
        BorderPane borderPane = new BorderPane();
        //创建scene
        Scene scene = new Scene(borderPane);

        //创建WebView和WebEngine对象
        WebView webView = new WebView();
        WebEngine webEngine = webView.getEngine();
        //使用类加载器加载本地HTML代码
        webEngine.load(ClassLoader.getSystemClassLoader().getResource("html/map.html").toExternalForm());
        borderPane.setCenter(webView);

        primaryStage.setScene(scene);
        primaryStage.show();
    }


    public static void main(String[] args) {
        launch(args);
    }
}
